﻿using System;
using System.Collections;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

namespace Card.Web
{
    /// <summary>
    /// $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Validate : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string action = context.Request.QueryString["a"].ToUpper();
            switch (action)
            {
                case "IS-LOGIN":
                    IsLogin(context);
                    break;
                default:
                    break;
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

        public void IsLogin(HttpContext context)
        {
            Card.Security.Passport passport = Card.Security.CookieManager.GetPassport(); 
            context.Response.ContentType = "text/plain";
            context.Response.Write(string.Format("{{'r':'{0}'}}", passport.IsLogin?"y":"n"));
        }
    }
}
